<html>
    <head>
        <meta charset="UTF-8">
        <title>类的构造函数</title>

        <script type="text/javascript">

            //1. 定义类
            class Point{
                _x = 0;
                _y = 0;
                constructor(x, y){
                    this._x = x;
                    this._y = y; 
                }

                get X(){
                    return this._x;
                }

                set X(x){
                    this._x = x;
                }
            }

            function init(){
                let point = new Point(116, 39);
                console.log("[x]:  " + point.X);
                point.X = 90;
                console.log("[x]:  " + point.X);
            }
        </script>
    </head>
    <body onload="init()"></body>
</html>